package tools

import (
	"log"
	"os/exec"
	"strconv"
)

func Command(path, key string) {
	isrtmp := Conf.Rtmp.BliBli
	log.Println("开始推流--->", path)
	if !Conf.Lock {
		//------ shell脚本
		//#!/bin/bash
		//ffmpeg -re -i "$1" -vcodec copy -acodec copy  -b:a 128k -r $2 -f flv "$3"
		//
		//----
		//cmd := exec.Command("sh", "ffmpeg.sh", path, strconv.Itoa(Conf.Fps), isrtmp+key)
		cmd := exec.Command("ffmpeg", "-re", "-i", path, "-vcodec", "copy", "-acodec", "copy", "-b:a", "128k", "-r", strconv.Itoa(Conf.Fps), "-f", "flv", isrtmp+key)
		output, err := cmd.CombinedOutput()
		if err = cmd.Run(); err != nil {
		}
		log.Printf("err--->%s", output)
		//time.Sleep(3000 * time.Millisecond)
	}

}
